package com.qjl.shopping.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qjl.shopping.bean.Account;
import com.qjl.shopping.bean.Act;
import com.qjl.shopping.bean.Admin;
import com.qjl.shopping.dao.AccountMapper;
import com.qjl.shopping.dao.ActMapper;
import com.qjl.shopping.dao.AdminMapper;
import com.qjl.shopping.service.ActService;
import com.qjl.shopping.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author liguanghui
 * @Date 2023/5/3
 */
@Service
public class ActServiceImpl extends ServiceImpl<ActMapper, Act> implements ActService {
    @Autowired
    private ActMapper actMapper;
    @Override
    public Page<Act> selectPage(int pageNum, int pageSize,int status,String title) {
        Page<Act> page = new Page<>(pageNum,pageSize);
        QueryWrapper queryWrapper = new QueryWrapper();
        if(status!=0){
            queryWrapper.eq("act_status",status);
        }
        if(!title.equals("")){
            queryWrapper.like("act_title",title);
        }
        queryWrapper.orderByDesc("act_id");
        Page<Act> actPage = actMapper.selectPage(page,queryWrapper);
        return actPage;
    }
}
